<!DOCTYPE html>
<html lang="zh-CN"  xmlns:th="http://www.thymeleaf.org">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>课程过程化管理 </title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">
    <!-- Bootstrap CSS-->
    <link rel="stylesheet" th:href="@{/static/vendor/bootstrap/css/bootstrap.min.css}">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet" th:href="@{/static/vendor/font-awesome/css/font-awesome.min.css}">
    <!-- Fontastic Custom icon font-->
    <link rel="stylesheet" th:href="@{/static/css/fontastic.css}">
    <!-- Google fonts - Poppins -->
    <link rel="stylesheet" th:href="@{https://fonts.googleapis.com/css?family=Poppins:300,400,700}">
    <!-- theme stylesheet-->
    <link rel="stylesheet" th:href="@{/static/css/style.default.css}" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" th:href="@{/static/css/custom.css}">
    <!-- Favicon-->
    <link rel="shortcut icon" th:href="@{/static/img/favicon.ico}">
    <!-- Tweaks for older IEs--><!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
  </head>
  <body>
    <div class="page">
      <!-- Main Navbar-->
      <header class="header">
        <nav class="navbar">
          <!-- Search Box-->
          <div class="search-box">
            <button class="dismiss"><i class="icon-close"></i></button>
            <form id="searchForm" action="#" role="search">
              <input type="search" placeholder="What are you looking for..." class="form-control">
            </form>
          </div>
          <div class="container-fluid">
            <div class="navbar-holder d-flex align-items-center justify-content-between">
              <!-- Navbar Header-->
              <div class="navbar-header">
                <!-- Navbar Brand --><a href="index.html" class="navbar-brand d-none d-sm-inline-block">
                  <div class="brand-text d-none d-lg-inline-block"><strong>侧栏</strong></div>
                  <div class="brand-text d-none d-sm-inline-block d-lg-none"><strong>BD</strong></div></a>
                <!-- Toggle Button--><a id="toggle-btn" href="#" class="menu-btn active"><span></span><span></span><span></span></a>
              </div>
              <!-- Navbar Menu -->
              <ul class="nav-menu list-unstyled d-flex flex-md-row align-items-md-center">
                <!-- Search-->
                <li class="nav-item d-flex align-items-center"><a id="search" href="#"><i class="icon-search"></i></a></li>
                <!-- Notifications-->
                <li class="nav-item dropdown"> <a id="notifications" rel="nofollow" data-target="#" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link"><i class="fa fa-bell-o"></i><span class="badge bg-red badge-corner">1</span></a>
                  <ul aria-labelledby="notifications" class="dropdown-menu">
                    <li><a rel="nofollow" href="#" class="dropdown-item"> 
                        <div class="notification">

                        </div></a></li>
                    <li><a rel="nofollow" href="#" class="dropdown-item all-notifications text-center"> <strong>view all notifications                                            </strong></a></li>
                  </ul>
                </li>
                <!-- Logout    -->
                <li class="nav-item"><a th:href="@{/logout}" class="nav-link logout"> <span class="d-none d-sm-inline">退出登录</span><i class="fa fa-sign-out"></i></a></li>
              </ul>
            </div>
          </div>
        </nav>
      </header>
      <div class="page-content d-flex align-items-stretch"> 
        <!-- Side Navbar -->
        <nav class="side-navbar">
          <!-- Sidebar Header-->
          <div class="sidebar-header d-flex align-items-center">
            <div class="avatar"><img th:src="@{/static/img/avatar-1.jpg}" alt="..." class="img-fluid rounded-circle"></div>
            <div class="title">
              <h1 class="h4" th:text="${session.Main.getSname()}"></h1>
              <p>学号:[[${session.loginUser}]]</p>
              <p>班级:[[${session.Main.getClassName().getClassname()}]]</p>
            </div>
          </div>
          <!-- Sidebar Navidation Menus--><span class="heading">Main</span>
          <ul class="list-unstyled">
                    <li><a th:href="@{/studentMain}"> </i>我的信息 </a></li>
                    <li class="active"><a th:href="@{/students/AllCourse}"></i>课程管理 </a></li>
                    <li><a th:href="@{/}"> <i class="icon-interface-windows"></i>返回主界面 </a></li>
          </ul>
        </nav>
        <div class="content-inner">
          <!-- Page Header-->
          <header class="page-header">
            <div class="container-fluid">
              <h2 class="no-margin-bottom">课程管理</h2>
            </div>
          </header>
          <!-- Dashboard Header Section    -->


          <div >
            <h1 class="h4" align="center">所有课程</h1>
            <table class="table table-hover table-bordered" border="1"align="center">

              <thead align="center"><tr class="font">
                <th style="width: 15%">课程编号</th><th style="width: 15%">课程介绍</th><th style="width: 20%">课程名称</th><th style="width: 15%">老师名称</th><th style="width: 10%">老师性别</th><th style="width: 20%">操作</th>
              </tr></thead>
              <!--<script type="text/javascript" th:inline="javascript">
                  /* <![CDATA[ */
                      var count;
                  /* ]]> */
              </script>-->
              <tbody align="center">
              <tr th:each="c:${courses}">
                <form th:action="@{/students/addCourse}">
                  <input type="hidden" name="Cid" th:value="${c.getCid()}">
                  <input type="hidden" name="pageNum" th:value="${page.pageNum}">
                  <td th:text="${c.getCid()}"></td>
                  <td><button type="button" th:onclick="editInfo([[${c.getInformation()}]],[[${c.getType()}]])" class="btn btn-info" data-toggle="modal" data-target="#editModal">查看</button></td>
                  <td th:text="${c.getCourse()}"></td>
                  <td th:text="${c.getTeacher().getTname()}"></td>

                  <!-- 判断男女 -->
                  <td th:if="${c.getTeacher().getTsex()==1}">男</td>
                  <td th:if="${c.getTeacher().getTsex()==0}">女</td>

                  <td th:if="${c.getIfjoin()==2} and ${c.getOpen()==1}" style="color: green;">已添加</td>
                  <td th:if="${c.getIfjoin()==1} and ${c.getOpen()==1}" style="color: red;">申请中</td>
                  <td th:if="${c.getIfjoin()==3} and ${c.getOpen()==1}" style="color: red;">退课中</td>
                  <td th:if="${c.getOpen()==0}" style="color: red;">已关闭申请</td>
                  <td th:if="${c.getIfjoin()==0} and ${c.getOpen()==1}"><button type="submit" class="btn btn-info">申请</button></td>
                </form>
                <!--<div th:each="j:${ifjoin}">
                  <td th:if="${c.getCid()==j.getCid()&&j.getIfjoin()==2}" style="color: green;">已添加</td>
                  <td th:if="${c.getCid()==j.getCid()&&j.getIfjoin()==1}" style="color: red;">申请中</td>
                  <td th:if="${c.getIfjoin()==3}"><a th:href="@{/}">申请</a></td>
                </div>-->
              </tr>
              </tbody>
            </table>
            <div style="text-align: center">
              <a href="?start=1" style="display: inline-block;">[首  页]</a>  <!-- 这是相对路径的写法。 前面没有斜线就是相对当前路径加上这个地址。 -->
              <div th:if="${page.pageNum - 1 > 0}" style="display: inline-block;">
                <a th:href="@{'/students/AllCourse?start='+${page.pageNum - 1}}" >[上一页]</a>
              </div>
              <div th:if="${page.pageNum +1 < page.pages +1}" style="display: inline-block;">
                <a th:href="@{'/students/AllCourse?start='+${page.pageNum + 1}}" >[下一页]</a>
              </div>
              <a th:href="@{'/students/AllCourse?start='+${page.pages}}" style="display: inline-block;">[末  页]</a>
            </div>
            <div align="center">
              当前页/总页数：<a href="?start=${page.pageNum}" th:text="${page.pageNum}"></a>/<a href="?start=${page.pages}" th:text="${page.pages}"></a>
            </div>
          </div>



          <!--显示课程介绍-->
          <div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
            <div class="modal-dialog">
              <div class="modal-content">

                <div class="modal-header">
                  <h4 class="modal-title" id="editModalLabel">
                    课程介绍
                  </h4>
                  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    ×
                  </button>
                </div>
                <div class="modal-body">

                  <div class="form-group">
                    <label for="type1" class="col-sm-3 control-label" style="color: blue">课程类型</label>
                    <div class="col-sm-9">
                      <input type="checkbox" id="type1" name="typeX" value="1" onclick="return false;"/> 考勤&nbsp;&nbsp;
                      <input type="checkbox" id="type2" value="1" name="typeX" onclick="return false;"/> 作业&nbsp;&nbsp;
                      <input type="checkbox" id="type3" value="1" name="typeX" onclick="return false;"/> 实验
                    </div>
                  </div>

                  <div class="form-group">
                    <label for="information" class="col-sm-3 control-label">课程介绍</label>
                    <div class="col-sm-9">
                      <textarea type="text" class="form-control" id="information" name="information" readonly="true"></textarea>
                    </div>
                  </div>

                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
                </form>

              </div>

              <!-- /.modal-content -->

            </div>

            <!-- /.modal -->
          </div>

          <script language='javascript' th:inline="javascript">
              function editInfo(information,type) {
                  $("#information").val(information);
                  var result=type.split(",");
                  var boxes = document.getElementsByName("typeX");
                  for(var i=0;i<boxes.length;i++){
                      if(result[i]=="1"){
                          boxes[i].checked=true;
                      }else {
                          boxes[i].checked=false;
                      }
                  }
              }
          </script>

          <style type="text/css">
            tr.font {
              font-size: 20px;
            }
            table.imagetable {
              font-family: verdana,arial,sans-serif;
              font-size:11px;
              color:#333333;
              border-width: 1px;
              border-color: #999999;
              border-collapse: collapse;
            }
            table.imagetable th {
              background:#b5cfd2 url('/static/css/bulecell.jpg');
              border-width: 1px;
              padding: 8px;
              border-style: solid;
              border-color: #999999;
            }
            table.imagetable td {
              background:#dcddc0 url('/static/css/greycell.jpg');
              border-width: 1px;
              padding: 8px;
              border-style: solid;
              border-color: #999999;
            }
          </style>

          <!-- Page Footer-->
          <footer class="main-footer">
            <div class="container-fluid">
              <div class="row">
                <div class="col-sm-6">
                  <p>成都信息工程大学 &copy; 2019</p>
                </div>
              </div>
            </div>
          </footer>
        </div>
      </div>
    </div>
    <!-- JavaScript files-->
    <script th:src="@{/static/vendor/jquery/jquery.min.js}"></script>
    <script th:src="@{/static/vendor/popper.js/umd/popper.min.js}"> </script>
    <script th:src="@{/static/vendor/bootstrap/js/bootstrap.min.js}"></script>
    <script th:src="@{/static/vendor/jquery.cookie/jquery.cookie.js}"> </script>
    <script th:src="@{/static/vendor/chart.js/Chart.min.js}"></script>
    <script th:src="@{/static/vendor/jquery-validation/jquery.validate.min.js}"></script>
    <script th:src="@{/static/js/charts-home.js}"></script>
    <!-- Main File-->
    <script th:src="@{/static/js/front.js}"></script>
  </body>
</html>